@@ -1,5 +1,8 @@
Revision history for Perl extension Catalyst::Plugin::Session
+0.32 2011-06-08
+ - Fix handling with enables verify_address and add related test
+
0.31 2010-10-08
- Fix session being loaded by call to dump_these in debug mode
(RT#58856)
@@ -32,5 +32,6 @@ t/lib/SessionValid/Controller/Root.pm
t/live_accessor.t
t/live_app.t
t/live_session_fixation.t
+t/live_verify_address.t
t/live_verify_user_agent.t
t/session_valid.t
@@ -35,4 +35,4 @@ requires:
resources:
license: http://dev.perl.org/licenses/
repository: http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Plugin-Session/0.00/trunk/
-version: 0.31
+version: 0.32
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
}
# Suspend handler for "redefined" warnings
@@ -9,7 +9,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -515,6 +515,7 @@ sub __extract_license {
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
+ 'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
@@ -550,9 +551,9 @@ sub license_from {
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
- \Qhttp://rt.cpan.org/\E[^>]+|
- \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
- \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ https?\Q://rt.cpan.org/\E[^>]+|
+ https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+ https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.01';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.99';
+ $VERSION = '1.01';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -230,8 +230,12 @@ sub preload {
sub new {
my ($class, %args) = @_;
- delete $INC{'FindBin.pm'};
- require FindBin;
+ delete $INC{'FindBin.pm'};
+ {
+ # to suppress the redefine warning
+ local $SIG{__WARN__} = sub {};
+ require FindBin;
+ }
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
@@ -463,4 +467,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2011 Adam Kennedy.
@@ -13,7 +13,7 @@ use Carp;
use namespace::clean -except => 'meta';
-our $VERSION = '0.31';
+our $VERSION = '0.32';
$VERSION = eval $VERSION;
my @session_data_accessors; # used in delete_session
@@ -225,6 +225,7 @@ sub _load_session {
no warnings 'uninitialized'; # ne __address
if ( $c->_session_plugin_config->{verify_address}
+ && exists $session_data->{__address}
&& $session_data->{__address} ne $c->request->address )
{
$c->log->warn(
@@ -13,6 +13,14 @@ sub login : Global {
$c->res->output("logged in");
}
+sub login_without_address : Global {
+ my ( $self, $c ) = @_;
+ $c->session;
+ $c->log->debug($c->request->address);
+ delete $c->session->{__address};
+ $c->res->output("logged in (without address)");
+}
+
sub logout : Global {
my ( $self, $c ) = @_;
$c->res->output(
@@ -9,6 +9,10 @@ use warnings;
__PACKAGE__->config('Plugin::Session' => {
# needed for live_verify_user_agent.t; should be harmless for other tests
verify_user_agent => 1,
+
+ # need for live_verify_address.t; should be harmless for other tests
+ verify_address => 1,
+
});
__PACKAGE__->setup;
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+ eval { require Catalyst::Plugin::Session::State::Cookie; Catalyst::Plugin::Session::State::Cookie->VERSION(0.03) }
+ or plan skip_all =>
+ "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test";
+
+ eval {
+ require Test::WWW::Mechanize::Catalyst;
+ Test::WWW::Mechanize::Catalyst->VERSION(0.51);
+ }
+ or plan skip_all =>
+ 'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test';
+
+ plan tests => 12;
+}
+
+use lib "t/lib";
+use Test::WWW::Mechanize::Catalyst "SessionTestApp";
+
+# Test without delete __address
+local $ENV{REMOTE_ADDR} = "192.168.1.1";
+
+my $ua = Test::WWW::Mechanize::Catalyst->new( {} );
+$ua->get_ok( "http://localhost/login" );
+$ua->content_contains('logged in');
+
+$ua->get_ok( "http://localhost/set_session_variable/logged/in" );
+$ua->content_contains('session variable set');
+
+
+# Change Client
+local $ENV{REMOTE_ADDR} = "192.168.1.2";
+
+$ua->get_ok( "http://localhost/get_session_variable/logged");
+$ua->content_contains('VAR_logged=n.a.');
+
+# Inital Client
+local $ENV{REMOTE_ADDR} = "192.168.1.1";
+
+$ua->get_ok( "http://localhost/login_without_address" );
+$ua->content_contains('logged in (without address)');
+
+$ua->get_ok( "http://localhost/set_session_variable/logged/in" );
+$ua->content_contains('session variable set');
+
+# Change Client
+local $ENV{REMOTE_ADDR} = "192.168.1.2";
+
+$ua->get_ok( "http://localhost/get_session_variable/logged" );
+$ua->content_contains('VAR_logged=in');
+
+
+